package com.app.service.system

import com.app.mapper.TRoleFuncMapper
import com.app.model.TRole
import com.app.model.TRoleFunc
import com.app.service.BaseService
import groovy.transform.CompileStatic
import groovy.transform.TypeChecked
import org.springframework.beans.factory.annotation.Autowired

/**
 * Created by three on 14-8-5.
 */
@CompileStatic
@TypeChecked
class RoleFuncService extends BaseService<TRoleFunc> implements IRoleFuncService {

    private TRoleFuncMapper roleFuncMapper;

    @Autowired
    public void setMapper(TRoleFuncMapper mapper) {
        super.baseMapper = mapper;
        this.roleFuncMapper = mapper;
    }

    @Override
    Long addBasic(TRoleFunc obj) throws Exception {
        def roleFunc = obj as TRoleFunc;
        roleFunc.setCreateTime(new Date())
        roleFunc.setCreateUserId(0L);
        return roleFuncMapper.insert(roleFunc);
    }

    @Override
    void modifyBasic(TRoleFunc obj) throws Exception {
        roleFuncMapper.updateByPrimaryKeySelective(obj as TRoleFunc);
    }

    @Override
    void delBasic(TRoleFunc obj) throws Exception {
        roleFuncMapper.deleteByPrimaryKey((obj as TRoleFunc).getId())
    }
}
